<%--
  Created by IntelliJ IDEA.
  User: Zero
  Date: 2021/5/7
  Time: 16:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>RequestMapping注解</title>
</head>
<body>
<h3>RequestMapping 注解基本使用</h3>
<table border="1">
    <tr>
        <th>方法</th>
        <th>说明</th>
    </tr>
    <tr>
        <td><a href="params/m1?name=Bob&password=abc123">m1</a></td>
        <td>当请求参数与方法参数名相同时，springmvc 框架会自动为我们封装</td>
    </tr>
    <tr>
        <td>
            <form action="params/m2" method="post">
                <input name="name" placeholder="用户名"><br>
                <input type="password" name="password" placeholder="用户密码"><br>

                <input name="account.name" placeholder="账户名"><br>
                <input type="password" name="account.password" placeholder="账户密码"><br>
                <input name="account.money" placeholder="余额"><br>
                <button type="submit">提交</button>
            </form>
        </td>
        <td>
            当请求参数与Java Bean属性名对应相同时，框架会自动为我们封装<br>
            如果被封装的bean中还有其他bean，可以通过<b>其他bean名.属性名</b>继续自动封装
        </td>
    </tr>
    <tr>
        <td>
            <form action="params/m3" method="post">
                <input name="list[0].name" placeholder="账户名"><br>
                <input type="password" name="list[0].password" placeholder="账户密码"><br>

                <input name="map['one'].name" placeholder="账户名"><br>
                <input type="password" name="map['one'].password" placeholder="账户密码"><br>
                <button type="submit">提交</button>
            </form>
        </td>
        <td>
            封装到集合：<br>
            封装到list：list名[下标].bean属性名<br>
            封装到map：map名['key'].bean属性名
        </td>
    </tr>
    <tr>
        <td>
            <form action="params/m4" method="post">
                <input name="name" placeholder="用户名"><br>
                <input type="password" name="password" placeholder="用户密码"><br>
                <input type="date" name="birthday" placeholder="生日"><br>
                <button type="submit">提交</button>
            </form>
        </td>
        <td>spring框架只能自动封装“YYYY/MM/dd”格式的日期类型，其他不支持，如果上传的格式不匹配，就需要自定义转化</td>
    </tr>
    <tr>
        <td><a href="params/m5">m5</a></td>
        <td>springmvc 框架会自动封装HttpServletRequest 和 HttpServletResponse 对象</td>
    </tr>
</table>
</body>
</html>
